#!/usr/bin/python
# -*- coding: UTF-8 -*-
# author : bird.zhang@ximalaya.com

import matplotlib.pyplot as plt
import numpy as np

# y轴数据
people = ('James', 'Durant', 'Kobe', 'Wade', 'Curry', 'Magic', 'Hardan')
y_pos = np.arange(len(people))

# x轴数据
performance = 30 + 70 * np.random.rand(len(people))  # 随机产生len(people)个 [0,1）的数
# 误差
error = np.random.rand(len(people))
# 这里是产生横向柱状图 barh h--horizontal
# plt.barh(y_pos, performance, xerr=error, align='center', alpha=0.4)

plt.barh(y_pos, performance, align='center', alpha=0.4)
plt.yticks(y_pos, people)
# x轴含义
plt.xlabel('count')
# x轴范围
plt.xlim(0, 100)
# 图片标签
plt.title('anchor_metadata')
plt.show()
